package com.neusoft.tijian.controller;

import com.neusoft.tijian.entity.Users;
import com.neusoft.tijian.service.UserService;
import com.neusoft.tijian.vo.RespVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api("系统登录")
@CrossOrigin("*")
public class UserController {
    @Autowired
    UserService userService;

    @PostMapping("/login")
    @ApiOperation(value = "用户登录", notes = "处理用户登录")
    public RespVo userLogin(@RequestBody Users users){
        return userService.userLogin(users);
    }

    @PostMapping("/register")
    @ApiOperation(value = "用户注册", notes = "用户注册")
    public RespVo register(@RequestBody Users users){
        return userService.register(users);
    }
}
